package cn.kgc.ssmmodulardemo.service.impl;

import cn.kgc.ssmmodulardemo.dao.UserMapper;
import cn.kgc.ssmmodulardemo.entity.User;
import cn.kgc.ssmmodulardemo.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    public User userLogin(User user) {
        List<User> userList=userMapper.queryAll();
        User result=null;
        for (User user1:userList){
            if((user1.getUserPassword().equals(user.getUserPassword()))
                    &&(user1.getUserCode().equals(user.getUserCode()))){
                result=user1;
                break;
            }
        }
        return result;
    }
}
